package com.tpfinal.agenda.view.renderers;

import java.io.IOException;
import java.net.URISyntaxException;
import java.net.URLEncoder;

public class GoogleMapsViewer {

	private static final String GOOLEMAPS_URL = "https://maps.google.com.ar/?q=%s";

	public static void view(String address) {

		// TODO: agregar como parametro la ciudad y el codigo postal

		java.awt.Desktop desktop = java.awt.Desktop.getDesktop();
		java.net.URI uri;
		try {
			uri = new java.net.URI(String.format(GOOLEMAPS_URL,
					URLEncoder.encode(address, "UTF-8")));
			desktop.browse(uri);
		} catch (URISyntaxException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

}
